package com.bwie.auth.controller;

import com.bwie.auth.service.AuthService;
import com.bwie.common.domain.request.UserReqLogin;
import com.bwie.common.domain.request.UserReqSignUp;
import com.bwie.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Author Junchen_N1
 * @Date 2025/6/17 9:17
 * @ClassName AuthController
 * @Description TODO
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    @PostMapping("/login")
    public Result<String> login(@RequestBody @Valid UserReqLogin userReqLogin){
        return authService.login(userReqLogin);
    }

    @PostMapping("/signUp")
    public Result signUp(@RequestBody @Valid UserReqSignUp userReqSignUp){
        authService.signUp(userReqSignUp);
        return Result.success();
    }

}
